<?php

namespace common\models\cb;

class CBUserNotifier
{
    private $mailer;

    public function __construct(CBMailer $mailer)
    {
        $this->mailer = $mailer;
    }

    public function notifyUser($userEmail, callable $messageGenerator)
    {
        $message = $messageGenerator();
        $this->mailer->send($userEmail, '通知', $message);
    }
}
